/**
 *  Copyright (c) 1997-2013, www.tinygroup.org (luo_guo@icloud.com).
 *
 *  Licensed under the GPL, Version 3.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *       http://www.gnu.org/licenses/gpl.html
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package org.tinygroup.dbf;

import java.io.File;
import java.io.IOException;

/**
 * Dbf输出器
 * Created by luoguo on 2014/7/10.
 */
public interface DbfWriter {
    int NAME_LENGTH = 10;
    int RECORD_COUNT_LENGTH = 4;
    int HEADER_LENGTH_LENGTH = 2;
    int RECORD_LENGTH_LENGTH = 2;
    int HEADER_END_CHAR = 13;

    /**
     * 输出DBF文档到文件
     *
     * @param dbfDocument 要输出的DBF文档
     * @param file        要输出到的DBF文件
     * @param encode      要输出的编码
     * @throws IOException
     */
    void writeDbf(DbfDocument dbfDocument, File file, String encode) throws IOException;

    /**
     * 输出DBF文档到文件
     * @param dbfDocument 要输出的DBF文档
     * @param fileName 要输出到的DBF文件名
     * @param encode 要输出的编码
     * @throws IOException
     */
    void writeDbf(DbfDocument dbfDocument, String fileName, String encode) throws IOException;
}
